#define imgupload(x)
        #if(IMAGE_HOST == "")
        <div class="form-group">
			<div class="col-sm-10" id="_#(x.index??)_bin">
				<label class="control-label no-padding-right" id="_#(x.index??)_upload" style="cursor:pointer;"><i class="fa fa-cloud-upload"></i>&nbsp;选择图片</label>&nbsp;&nbsp;
				<label class="control-label no-padding-right" id="_#(x.index??)_delete" style="cursor:pointer;"><i class="fa fa-times"></i>&nbsp;删除图片</label>
				<input type="hidden" id="_#(x.index??)" data-type="imgupload" name="token_#(table??x.table).#(x.index??)"  value=""  class="form-control"/>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-8" id="img_upload">
				<img id="_#(x.index??)_IMG" src="/static/basic/img/img.jpg" data-auto="#(x.auto??)" style="padding:2px; border:1px solid #ccc;cursor:pointer;width:#(x.width??'170px');height:#(x.height??'110px');"></img>
			</div>
		</div>
		<div class="form-group" style="display:none;">
			<textarea  id="_#(x.index??)_editor" name="#(x.index??)_editor" ></textarea>
		</div>
		
		<script charset="utf-8" src="/static/kindeditor/kindeditor-all-min.js"></script>
		<script type="text/javascript">
		function _#(x.index??)_loadimgupload(){
			$("#_#(x.index??)_IMG").bind("click",function() {
				var src = $(this).attr("src");
				if(src != "/static/basic/img/img.jpg"){
					window.open(src);
				}
			});
			$("#_#(x.index??)_delete").bind("click",function() {
				var _name = $("#_#(x.index??)").attr("name").replace("token_", "");
				$("#_#(x.index??)").attr("name", _name);
				$("#_#(x.index??)").val("");
				$("#_#(x.index??)_IMG").attr("src","/static/basic/img/img.jpg");
				$("#form_token").val(1);
			});
			
			var editor = KindEditor.create('textarea[name="#(x.index??)_editor"]', {
				uploadJson : '/kindeditor/upload_#(x.blob??'json')',
				fileManagerJson : '/kindeditor/file_manager_json',
				allowFileManager : false,
				extraFileUploadParams : {dir:"#(x.dir)", uploadType : "#(x.uploadType)",typeCode:"#(x.typeCode)",attachId:"#(x.attachId)",table:"#(x.table)"},
				imageSizeLimit:'5MB'
			});
			
			KindEditor("#_#(x.index??)_upload").click(function () {
	              editor.loadPlugin('image', function () {
	                    editor.plugin.imageDialog({
	                        clickFn: function (url,title) {
	        					var _name = $("#_#(x.index??)").attr("name").replace("token_", "");
	        					$("#_#(x.index??)").attr("name", _name);
	                        	$("#_#(x.index??)").val(title);
	                            $("#_#(x.index??)_IMG").attr("src",url);
	                            $("#form_token").val(1);
	                            editor.hideDialog();
	                        }
	                    });
	                }); 
	        });
		}
			
			
			
			
			
			/* function initImgUpload(id, type){
				$.post("/kindeditor/initimg", {id : id}, function(data){
					if(data.code === 0){
						if(type == "view"){
							$("#_#(x.index??)_BTN").css("display", "none");
						}
						$("#_#(x.index??)_IMG").attr("src", ""+ data.data.attachId);
					}
					else{
						layer.alert("加载图片失败", {
							icon : 7
						});
					}
					
				}, "json");
			} */
			
			function _#(x.index??)_initImgUpload(id, type){
				_#(x.index??)_loadimgupload();
				if(type == "view"){
					$("#_#(x.index??)_bin").css("display", "none");
				}
				$("#_#(x.index??)_IMG").attr("src", "/kindeditor/renderFile/"+id);
			}
		</script>
        #end
		
#end